import service from "@/utils/request";

export function login(data:any){
    return service({
        url:'/admin/login/',
        method:'post',
        data
    })
}

/**     关于博文的增删改查            */
export function getPostList(query:any){
    return service({
        url:'/admin/post/',
        method:'get',
        params: query
    })
}

export function getPost(id: any) {
    return service({
        url: '/admin/post/' + id,
        method: 'get',
    })
}

export function savePost(data:any){
    return service({
        url:'/admin/post/',
        method:'post',
        data
    })
}

export function updatePost(data:any,id:any){
    return service({
        url:'/admin/post/'+id+'/',
        method:'put',
        data
    })
}

export function deletePost(id:any){
    return service({
        url:'/admin/post/'+id+'/',
        method:'delete',
    })
}

export function patchPost(data:any,id:any){
    return service({
        url:'/admin/post/'+id+'/',
        method:'patch',
        data
    })
}

export function uploadAvatar(data:any){
    return service({
        url:'/admin/saveAvatar/',
        method:'post',
        data,
        headers:{
             'Content-Type': 'multipart/form-data',
        }
    })
}